/**
 * @param {string[]} array
 * @return {string[]}
 */
// 超时了这个方法
var findLongestSubarray = function (array) {
    let l = array.length;
    let charater = 0, num = 0
    let longest = 0, start = 0
    let value,a,s;
    let reg = /[a-zA-Z]/
    const m = new Map()
    m.set(0, -1)
    for(let i = 0; i < l; i++) {
        value = array[i]
        if(reg.test(value)) charater++
        else num++
        a = charater - num
        if(m.has(a)) {
            if(i -(s = m.get(a)) > longest) {
                longest =  i - s;
                start = s + 1
            }
        } else {
            m.set(a, i)
        }
    }
    return array.splice(start, longest)
};
console.log(findLongestSubarray([]));
console.log(findLongestSubarray(["A", "1"]));
console.log(findLongestSubarray([]));